﻿@{
    ViewBag.Title = "Bảng điều khiển";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<div id="dashboard">
    <div class="row-fluid">
        @if(ViewBag.IsSinhVien){
        <div class="span8">
             @(Html.Kendo().Chart<StudentPortal.ViewModels.TBMHKViewModel>()
                .Name("chart")
                .Title("Điểm trung bình môn các học kỳ")
                .Legend(legend => legend
                    .Position(ChartLegendPosition.Top)
                )
                .DataSource(ds => ds.Read(read => read.Action("getDiemHocKy", "Home")))
                .Series(series => {
                    series.Area(model => model.Diem).Name("Điểm hệ 4");
                })
                .CategoryAxis(axis => axis
                    .Categories(model => model.Hoc_ky)
                    .Labels(labels => labels.Rotation(-45))
                    .Justify()
                )
                .ValueAxis(axis => axis.Numeric()
                    .Labels(labels => labels.Format("{0:0.0}"))
                    .MajorUnit(0.5)
                )
                .Tooltip(tooltip => tooltip
                    .Visible(true)
                    .Format("{0:0.0}")
                )
            ) 
        </div>
        }
        <div class="@(ViewBag.IsSinhVien?"span4":"span12")">
            <div class="portlet box red">
				<div class="portlet-title">
					<h4><i class="icon-reorder"></i>Tin mới</h4>
					<div class="tools">
						<a class="collapse" href="javascript:;"></a>
					</div>
				</div>
				<div class="portlet-body">
                    
                    <div class="scroller" data-height="290px" data-always-visible="1" data-rail-visible1="1">
						<ul class="feeds">
                            @foreach (var news in ViewBag.News)
                            {
							<li>
								<div class="col1">
									<div class="cont">
										<div class="cont-col1">
											<div class="label label-success">
												<i class="icon-bell"></i>
											</div>
										</div>
										<div class="cont-col2">
											<div class="desc">
                                                @{var max_length = 45;}
												@if (news.Title.Length > max_length)
                                                {
                                                    <a href="@Url.Action("Details", "News", new {Area="" ,Id = news.Id})">@String.Format("{0}...", news.Title.Substring(0, max_length-3))</a>
                                                }
                                                else{
                                                    <a href="@Url.Action("Details", "News",new{Id=news.Id,Area="" })"> @news.Title</a>
                                                }   
											</div>
										</div>
									</div>
								</div>
								<div class="col2">
									<div class="date">
										@news.PostDate.ToString("dd/MM/yyyy")
									</div>
								</div>
							</li>
                            }
                        </ul>
                        </div>
                    
				</div>
			</div>
        </div>
    </div>
</div>
<script src="@Url.Content("~/Content/themes/assets/jquery-slimscroll/jquery-ui-1.9.2.custom.min.js")"></script>	
<script src="@Url.Content("~/Content/themes/assets/jquery-slimscroll/jquery.slimscroll.min.js")"></script>